Skip to content

Add terrain tiles, with elevations encoded as RGB values.#660

Merged
bdon merged 2 commits into
protomaps:mainfrom
brawer:terrain
May 26, 2026
Merged

Add terrain tiles, with elevations encoded as RGB values.#660
bdon merged 2 commits into
protomaps:mainfrom
brawer:terrain

Conversation

@brawer

@brawer brawer commented May 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread spec/v3/spec.md Outdated
@bdon

bdon commented May 13, 2026

Copy link
Copy Markdown
Member

The consequences of this spec addition would be:

  1. Inspectors like pmtiles.io can render and inspect Elevation tiles with real values, instead of showing the RGB raw tiles
  2. tooling GDAL in the future can support PMTiles as an elevation source directly, although this would require changes within GDAL

Seeking additional comments, like if we should support encoding:mapbox?

@bdon

bdon commented May 15, 2026

Copy link
Copy Markdown
Member

Related: mapbox/tilejson-spec#28

@bdon bdon merged commit 8b8ddea into protomaps:main May 26, 2026
2 checks passed
@bdon

bdon commented May 26, 2026

Copy link
Copy Markdown
Member

@ingalls @wipfli per today's conversation, I've merged this into the spec.

@jo-chemla

Copy link
Copy Markdown

Nice to hear the pmtiles spec now accepts specifying the encoding: terrarium metadata! Is it also made to accept encoding: terrain-rgb where elevation from rgb formula is elev = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)? Thanks!

@bdon

bdon commented May 27, 2026

Copy link
Copy Markdown
Member

Can you provide a list of tile generation software and/or map rendering clients that use encoding: terrain-rgb right now?

We are encouraging encoding: "terrarium" to cover the happy path of using Mapzen Terrain, Mapterhorn and MapLibre together: https://maplibre.org/maplibre-style-spec/sources/#encoding_1

@jo-chemla

Copy link
Copy Markdown

The only terrain sources I encountered using TerrainRGB encoding - available on terrain-viewer:

  • MapTiler
  • of course Mapbox
  • and then some regional/local terrain DxMs like ESP - TerrainRGB Nuevo servicio XYZ del Modelo Digital de Elevaciones de España at this link or this one from gbank.gsj.jp
  • also some commercial terrain sources like Nimbo
  • LINZ was also exposing as TerrainRGB see mention but I cannot find it back.

@bdon

bdon commented May 27, 2026

Copy link
Copy Markdown
Member

Thanks, those seem to be tilesets with RGB encoding but they do not actually define a value in a tileset or renderer specification called encoding: terrain-rgb with a precise meaning.

Here is how the current Mapbox GL JS docs define encoding: https://docs.mapbox.com/style-spec/reference/sources/#raster-dem-encoding

In the case of tile generation projects like Mapterhorn, we have not observed a need for encoding: mapbox, since the sources available in that encoding are proprietary tile APIs and not static tilesets or pmtiles archives.

If you can provide some examples of places where encoding: mapbox is used with static tilesets we can consider adding that to the specification.

@jo-chemla

jo-chemla commented May 27, 2026

Copy link
Copy Markdown

All the shared TMS/XYZ tilesets share the same underlying TerrainRGB encoding formula from mapbox indeed. When these terrain sources added to terrain-viewer via the BYOD Bring-Your-Own-Data panel, they all display correctly thanks to maplibre terrain-rgb decoding.

Terrarium encoding has many benefits over terrain-rgb (resolution, finer grained data, going beyond the -10km range etc), so it's great that the ecosystem is pushing towards terrarium encoding within pmiles containers, given that all existing global tilesets listed are proprietary.

There are some open-data national terrain tiled datasets that do use that mapbox encoding though, like that spanish example. Not sure if this is a living example of a static tileset, but I would assume so - it's also possible this terrain dataset is not only published as terrain-rgb but also as DSM COG. Hope this helps!

ESP - TerrainRGB Nuevo servicio XYZ del Modelo Digital de Elevaciones de España at this link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants